`brew install swiftformat`


To avoid beep sound on ⌃⌘←/→: create a ~/Library/KeyBindings/DefaultKeyBinding.dict with the following contents (or append, if you have one already):
{
  "@^\UF701" = "noop";
  "@^\UF702" = "noop";
  "@^\UF703" = "noop";
}

#export XCBBUILDSERVICE_PATH=/Users/admin/Developer/swift-build/.build/arm64-apple-macosx/debug/SWBBuildServiceBundle


keybindings.json:
[
    {
        "command": "workbench.action.openPreviousRecentlyUsedEditorInGroup",
        "key": "ctrl+cmd+left"
    },
    {
        "command": "workbench.action.openNextRecentlyUsedEditorInGroup",
        "key": "ctrl+cmd+right"
    },
    {
        "key": "cmd+shift+[",
        "command": "workbench.action.previousEditor"
    },
    {
        "key": "cmd+shift+]",
        "command": "workbench.action.nextEditor"
    },
    {
        "key": "shift+alt+cmd+j",
        "command": "revealFileInOS",
        "when": "editorTextFocus || filesExplorerFocus"
    },
    {
        "key": "shift+cmd+j",
        "command": "revealInExplorer",
        "when": "editorTextFocus"
    },
    {
        "key": "cmd+b",
        "command": "workbench.action.tasks.build",
        "when": "taskCommandsRegistered"
    },
    {
        "key": "cmd+r",
        "command": "workbench.action.debug.start",
        "when": "debuggersAvailable && debugState == 'inactive'"
    },
    {
        "key": "cmd+r",
        "command": "debug.openView",
        "when": "!debuggersAvailable"
    },
    {
        "key": "cmd+\\",
        "command": "editor.debug.action.toggleBreakpoint",
        "when": "debuggersAvailable && disassemblyViewFocus || debuggersAvailable && editorTextFocus"
    },
    {
        "key": "cmd+.",
        "command": "workbench.action.debug.stop",
        "when": "inDebugMode && !focusedSessionIsAttach"
    },
    {
        "key": "ctrl+k",
        "command": "-deleteAllRight",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "ctrl+k",
        "command": "editor.action.deleteLines",
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "shift+cmd+k",
        "command": "swift.cleanBuild"
    },
    {
        "key": "shift+cmd+backspace",
        "command": "editor.action.inlineDiffs.cancelEdits",
        "when": "editorTextFocus && hasActivelyGeneratingDiff"
    },
    {
        "key": "cmd+backspace",
        "command": "-editor.action.inlineDiffs.cancelEdits",
        "when": "editorTextFocus && hasActivelyGeneratingDiff"
    },
    {
        "key": "shift+cmd+backspace",
        "command": "editor.action.cancelGPT4WithCmdDelete",
        "when": "hadGPT4InlineCompletionRunning"
    },
    {
        "key": "cmd+backspace",
        "command": "-editor.action.cancelGPT4WithCmdDelete",
        "when": "hadGPT4InlineCompletionRunning"
    },
    {
        "key": "shift+cmd+backspace",
        "command": "editor.action.inlineDiffs.cancelPromptBar",
        "when": "editorTextFocus && hasActivelyGeneratingPromptBarDiff"
    },
    {
        "key": "cmd+backspace",
        "command": "-editor.action.inlineDiffs.cancelPromptBar",
        "when": "editorTextFocus && hasActivelyGeneratingPromptBarDiff"
    },
    {
        "key": "shift+cmd+backspace",
        "command": "chatEditor.action.reject",
        "when": "chat.hasEditorModifications && editorFocus && hasUndecidedChatEditingResource && !chat.ctxHasRequestInProgress || chat.hasNotebookEditorModifications && editorFocus && hasUndecidedChatEditingResource && !chat.ctxHasRequestInProgress"
    },
    {
        "key": "cmd+backspace",
        "command": "-chatEditor.action.reject",
        "when": "chat.hasEditorModifications && editorFocus && hasUndecidedChatEditingResource && !chat.ctxHasRequestInProgress || chat.hasNotebookEditorModifications && editorFocus && hasUndecidedChatEditingResource && !chat.ctxHasRequestInProgress"
    },
    {
        "key": "shift+cmd+backspace",
        "command": "composer.cancelComposerStep",
        "when": "composerFocused"
    },
    {
        "key": "cmd+backspace",
        "command": "-composer.cancelComposerStep",
        "when": "composerFocused"
    },
    {
        "key": "cmd+i",
        "command": "composerMode.agent"
    },
    // === Xcode-style keybindings ===
    {
        "key": "cmd+alt+[",
        "command": "editor.action.moveLinesUpAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "cmd+alt+]",
        "command": "editor.action.moveLinesDownAction",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "alt+cmd+c",
        "command": "workbench.action.terminal.toggleTerminal",
        "when": "!terminalFocus"
    },
    {
        "key": "alt+cmd+c",
        "command": "workbench.action.terminal.focus",
        "when": "terminalIsOpen && !terminalFocus"
    },
    {
        "key": "shift+cmd+c",
        "command": "git.commit",
        "when": "scmProvider == 'git'"
    },
    {
        "key": "alt+f",
        "command": "editor.action.selectAllMatches",
        "when": "editorFocus && findWidgetVisible"
    },
    {
        "key": "ctrl+shift+b",
        "command": "workbench.action.tasks.build",
        "when": "taskCommandsRegistered"
    },
    {
        "key": "ctrl+shift+b",
        "command": "workbench.action.showCommands",
        "when": "!taskCommandsRegistered"
    },
    {
        "key": "alt+cmd+n",
        "command": "explorer.newFolder",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
        "key": "alt+shift+f",
        "command": "editor.action.selectHighlights",
        "when": "editorFocus"
    },
    {
        "key": "cmd+shift+p",
        "command": "workbench.action.showCommands"
    },
    {
        "key": "cmd+up",
        "command": "cursorTop",
        "when": "editorTextFocus"
    },
    {
        "key": "cmd+down",
        "command": "cursorBottom",
        "when": "editorTextFocus"
    },
    {
        "key": "cmd+shift+i",
        "command": "workbench.action.chat.open"
    },
    {
        "key": "ctrl+up",
        "command": "editor.action.transformToUppercase",
        "when": "editorTextFocus && editorHasSelection"
    },
    {
        "key": "ctrl+down",
        "command": "editor.action.transformToLowercase",
        "when": "editorTextFocus && editorHasSelection"
    },
    {
        "key": "ctrl+left",
        "command": "cursorWordPartLeft",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+right",
        "command": "cursorWordPartRight",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+delete",
        "command": "deleteWordPartRight",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+backspace",
        "command": "deleteWordPartLeft",
        "when": "editorTextFocus && !editorReadonly"
    },
    {
        "key": "ctrl+shift+left",
        "command": "cursorWordPartLeftSelect",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+right",
        "command": "cursorWordPartRightSelect",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+up",
        "command": "editor.action.insertCursorAbove",
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+shift+down",
        "command": "editor.action.insertCursorBelow",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+up",
        "command": "cursorMove",
        "when": "editorTextFocus",
        "args": { "to": "up", "by": "wrappedLine", "value": 5 }
    },
    {
        "key": "alt+down",
        "command": "cursorMove", 
        "when": "editorTextFocus",
        "args": { "to": "down", "by": "wrappedLine", "value": 5 }
    },
    {
        "key": "alt+shift+up",
        "command": "cursorMove",
        "when": "editorTextFocus",
        "args": { "to": "up", "by": "wrappedLine", "value": 5, "select": true }
    },
    {
        "key": "alt+shift+down",
        "command": "cursorMove",
        "when": "editorTextFocus",
        "args": { "to": "down", "by": "wrappedLine", "value": 5, "select": true }
    },
    {
        "key": "cmd+d",
        "command": "editor.action.duplicateSelection",
        "when": "editorTextFocus"
    },
    {
        "key": "alt+f",
        "command": "editor.action.selectAllMatches",
        "when": "editorFocus && findWidgetVisible"
    },
    {
        "key": "cmd+alt+shift+f",
        "command": "workbench.action.replaceInFiles"
    },
    {
        "key": "cmd+shift+o",
        "command": "workbench.action.quickOpen"
    },
    {
        "key": "cmd+shift+t",
        "command": "workbench.action.tasks.runTask"
    }
]

~/Library/Application Support/Cursor/User/tasks.json:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Format Swift Imports",
            "type": "shell",
            "command": "swiftformat",
            "args": [
                "--swiftversion", "5.0",
                "--rules", "sortedImports",
                "${file}"
            ],
            "group": "build",
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared"
            },
            "problemMatcher": []
        }
    ]
}